﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;

namespace _1.SHA1HashCodeCalculator
{
    public class SHA1HashCodeCalculator
    {
        public static byte[] ComputeHash(string fileName)
        {
            using (FileStream reader = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                byte[] hash = SHA1HashCodeCalculator.ComputeHash(reader);
                return hash;
            }            
        }

        public static byte[] ComputeHash(Stream stream)
        {
            SHA1 sha1 = SHA1.Create();
            byte[] hash = sha1.ComputeHash(stream);
            
            return hash;
        }
    }
}
